FROM golang:1.17-alpine as go-build
ENV GO111MODULE=on \
    GOPROXY="https://goproxy.cn,direct" \
    CGO_ENABLED=0 \
    GOARCH=amd64
COPY . /app
RUN cd /app && go build main.go

FROM alpine:3.12
COPY --from=go-build /app/main /app/main
#COPY --from=go-build /app/config /app/config
#COPY --from=go-build /app/storage /app/storage
WORKDIR /app
EXPOSE 80 8080 9000
CMD ["/app/main"]

#创建mysql 实例
#docker run --name docker-mysql-golang -p 13306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /Users/heijiangtao/docker/mysql:/var/lib/mysql -d mysql:8.0.19
#docker build . -t one-project
#docker run --link=docker-mysql-golang:docker-mysql-golang -p 10688:8080 one-project
